﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace StudentWeb.Models
{
    public class MockStudentRepo : IStudentRepo
    {
        private List<Student> list = null;
        //public MockStudentRepo()
        //{
        //    if (list == null)
        //    {
        //        list = new List<Student>()
        //        {
        //            new Student(1,"a","M",11){},
        //            new Student(2,"b","F",14){},
        //            new Student(3,"c","F",16){},
        //            new Student(4,"d","M",18){}
        //        };
        //    }
        //}

        //public Student EditStudent(Student student)
        //{
        //    list[student.id] = student;
        //    return student;
        //}

        public IEnumerable<Student> GetALLStudents()
        {
            return list;
        }

        public Student GetStudentById(int id)
        {
            //return list.Where(u => u.id.Equals(id)).FirstOrDefault();
            return list.FirstOrDefault(u => u.id == id);
        }
    }
}
